home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue24 / tiptrix / LISTING2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-07-21  |  788 b   |  28 lines

  1. function CommaDelimStrToTrect(const s: string): trect;
  2. var
  3.   tmp, wrkstr : string;
  4. begin
  5.   if pos(æ"Æ, s) <> 0 then
  6.     {strip the double quotes, if present}
  7.     tmp := stripsymbol(s, æ"Æ)
  8.   else
  9.     tmp := s;
  10.   wrkstr := get_Word_UpTo(tmp, æ,Æ);
  11.   result.left := strToInt(wrkstr);
  12.   wrkstr := get_nth_word(tmp, 2, [æ,Æ]);
  13.   result.top := StrToInt(wrkstr);
  14.   wrkstr := get_nth_word(tmp, 3, [æ,Æ]);
  15.   result.right := StrToInt(wrkstr);
  16.   wrkstr := get_nth_word(tmp, 4, [æ,Æ]);
  17.   result.bottom := strToInt(wrkstr);
  18. end;
  19.  
  20. function StripSymbol(const s, sym: string): string;
  21. {takes out any occurrences of symbol}
  22. begin
  23.   result := s;
  24.   while pos(sym,result) <> 0 do
  25.     result := copy(result, 1, pos(sym,result)-1) +
  26.      copy(result, pos(sym, result)+1, 255);
  27. end;
  28.